Connect to dynamic simulation API with full parameters#37
Conversation
- correct the copy files into test file system
…tificationService for message queue
c8db96d to
7f769f8
Compare
src/main/java/org/gridsuite/ds/server/service/DynamicSimulationService.java
Outdated
Show resolved
Hide resolved
| notificationService.emitResultDynamicSimulationMessage(sendMessage); | ||
| LOGGER.info("Dynamic simulation complete (resultUuid='{}')", resultContext.getResultUuid()); | ||
| }) | ||
| .toFuture().get(); |
There was a problem hiding this comment.
to investigate, at least put a big comment
There was a problem hiding this comment.
At the moment, I put only more comments
src/main/java/org/gridsuite/ds/server/service/DynamicSimulationWorkerService.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/ds/server/service/DynamicSimulationWorkerService.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/ds/server/service/DynamicSimulationWorkerService.java
Outdated
Show resolved
Hide resolved
| <constraints nullable="false" primaryKey="true" primaryKeyName="resultPK"/> | ||
| </column> | ||
| <column name="result" type="BOOLEAN"/> | ||
| <column name="result" type="UUID"/> |
There was a problem hiding this comment.
why not a separate changeset ?
| debug: true | ||
|
|
||
| dynawaltz-default-parameters: | ||
| parametersFile: /home/phamquy/Projects/dynawo/test/models.par |
There was a problem hiding this comment.
No, in fact there is a service, i.e. ParametersService, which configures parameters for Dynawaltz. This service does not use "dynawaltz-default-parameters".
I will remove all params in "dynawaltz-default-parameters"
| @@ -0,0 +1,11 @@ | |||
| dynawaltz: | |||
| homeDir: /home/runner/work/dynamic-simulation-server/dynawo | |||
There was a problem hiding this comment.
Yes, homDir is mandatory and loaded by DynaWaltzConfig for the DynaWaltzProvider.
In prod env, config.yml is in the config directory ~/.itool
There was a problem hiding this comment.
In the next step, we will test with container.. so this config can be removed?
There was a problem hiding this comment.
yes! it is used when launching tests.
| /** | ||
| * @author Mathieu Bague <mathieu.bague@rte-france.com> | ||
| */ | ||
| public class GroovyCurvesSupplier implements CurvesSupplier { |
There was a problem hiding this comment.
To remove and use core one when switching to 5.1.0
There was a problem hiding this comment.
Noted by add comment into code
| /** | ||
| * @author Marcos de Miguel <demiguelm at aia.es> | ||
| */ | ||
| public class GroovyEventModelsSupplier implements EventModelsSupplier { |
There was a problem hiding this comment.
To remove and use core one when switching to 5.1.0
There was a problem hiding this comment.
Noted by add comment into code
| NOT_DONE, | ||
| RUNNING, | ||
| COMPLETED | ||
| CONVERGED, |
There was a problem hiding this comment.
To check but I think SUCCEED and FAILED is more accurate than CONVERGED and DIVERGED for a dynamic simulation.
There was a problem hiding this comment.
In my opinion, CONVERGED and DIVERGED are two sub-states of SUCCEED. In contrast, FAILED is another state which relates to a technical issue.
|
|
||
| private String name; | ||
|
|
||
| private String parentName; |
There was a problem hiding this comment.
What are the purposes of parentName and current?
There was a problem hiding this comment.
This Dto is from the one in dynamic-mapping-server, so may be some fields are not really useful in dynamic-simulation-server.
'parentName' is the name of mapping
'name' is the name of script given by dynamic-mapping-server during the generation
In fact, these two names are not used for the computation but may be useful for the log, so I will keep these fields.
The field 'current', as I see in the implementation ScriptServiceImpl#isScriptCurrent(Script) in dynamic-mapping-server, is used to say that the script generated at some moment is out of date or not (in comparing to the modified date of the mapping). This field is not used in dynamic-simulation-server since the script is always generated on-demand.
I will remove this field in this Dto in dynamic-simulation-server
| Objects.requireNonNull(message); | ||
|
|
||
| String parametersPayload = message.getPayload(); | ||
| ByteArrayInputStream bytesIS = new ByteArrayInputStream(parametersPayload.getBytes()); |
There was a problem hiding this comment.
For simplicity, I will change the code by typing the payload as byte[] instead of currently as String to avoid a wasting step of conversion to String.
| @@ -0,0 +1,281 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
There was a problem hiding this comment.
Is this file useful ? already in resources in src/test/resources/data/ieee14/_01/input/models.par ?
There was a problem hiding this comment.
The same name but the content may be different. It is used for testing the xml merge tool. In my opinion, it is better to separate test data.. So I will keep this file..
Anyway, the merge tool will be removed when the multi input-files implementation at dynawo finished
| private void sendResultMessage(Message<String> message) { | ||
| OUTPUT_MESSAGE_LOGGER.debug("Sending message : {}", message); | ||
| publishResult.send("publishResult-out-0", message); | ||
| List<TimeSeries> timeSeries = new ArrayList(result.getCurves().values()); |
|
|
||
| // prepare expected result to compare | ||
| DynamicSimulationResult expectedResult = DynamicSimulationResultDeserializer.read(getClass().getResourceAsStream(Paths.get(DATA_IEEE14_BASE_DIR, testBaseDir, OUTPUT, RESULT_JSON).toString())); | ||
| String jsonExpectedTimeSeries = TimeSeries.toJson(new ArrayList(expectedResult.getCurves().values())); |
| String jsonResultTImeSeries = TimeSeries.toJson(TIME_SERIES_MOCK_BD.remove(timeSeriesUuid)); | ||
|
|
||
| // compare result only timeseries | ||
| ObjectMapper mapper = new ObjectMapper(); |
There was a problem hiding this comment.
Inject Spring one instead of creating a new one?
| true, | ||
| parametersFile); | ||
|
|
||
| ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); |
2 - Partial implementation 'stop' endpoint
|
add a comment in the code for all the things that must be deleted in the near future (config.yml /home/runner, groovy stuff copypasted) |
Done! |
| XmlMerge xmlMerge = new SimpleXmlMerge(); | ||
| try { | ||
| Document mergedDoc = xmlMerge.merge(dynamicParamsIs, eventsParamsIs); | ||
| xmlMerge.export(mergedDoc, Files.newOutputStream(tmpDir.resolve(modelParFileName))); |
There was a problem hiding this comment.
Output stream should be closed
|
Kudos, SonarCloud Quality Gate passed! |








Uh oh!
There was an error while loading. Please reload this page.